package com.baida.retail.tasksystem.dao.impl;

import com.baida.retail.tasksystem.dao.OrderDao;
import com.baida.retail.tasksystem.entity.Order;
import com.baida.retail.tasksystem.mapper.ext.OrderMapperExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

@Component
public class OrderDaoImpl implements OrderDao {
    @Autowired
    private OrderMapperExt orderMapperExt;

    @Override
    public int updateDeliveryTime(Long orderId, Date deliveryDate, String deliveryTimeSlot, boolean deliveredAsSoonAsPossible) {
        return orderMapperExt.updateDeliveryTime(orderId, deliveryDate, deliveryTimeSlot, deliveredAsSoonAsPossible);
    }

    @Override
    public int setAquaticProductionFinished(Long orderId) {
        return orderMapperExt.updateAquaticProductionToFinished(orderId);
    }

    @Override
    public Order getById(Long orderId) {
        return orderMapperExt.selectByOrderId(orderId);
    }

    @Override
    public List<Order> getOrdersById(List<Long> orderIds) {
        return orderMapperExt.selectByOrderIds(orderIds);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return orderMapperExt.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Order record) {
        return orderMapperExt.insert(record);
    }

    @Override
    public int insertSelective(Order record) {
        return orderMapperExt.insertSelective(record);
    }

    @Override
    public Order selectByPrimaryKey(Integer id) {
        return orderMapperExt.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Order record) {
        return orderMapperExt.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Order record) {
        return orderMapperExt.updateByPrimaryKey(record);
    }
}
